package com.ghpt.controller;
import com.ghpt.pojo.XQXiangYing;
import com.ghpt.service.XQXiangYingService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RestController
@RequestMapping("/xiangying")
public class XQXiangYingController {
    private final XQXiangYingService xQXiangYingService;

    public XQXiangYingController(XQXiangYingService xQXiangYingService) {
        this.xQXiangYingService = xQXiangYingService;
    }
    @GetMapping("/{id}")
    public XQXiangYing getXQXiangYingById(@PathVariable Long id) {
        System.out.println("结果是"+xQXiangYingService.findXQXiangYingById(id));
        return xQXiangYingService.findXQXiangYingById(id);
    }
    @PutMapping
    public int updateXQXiangYing(@RequestBody XQXiangYing xQXiangYing) {
        return xQXiangYingService.updateById(xQXiangYing);
    }
}
